<template>
  <div class="dialog_import">
    <el-form :model="{}" size="medium" :inline="true" label-width="60px">
      <el-form-item label="操作栏" prop="" v-hasPermi="['manage_basevalue_add']">
        <el-button type="warning" plain icon="el-icon-download" size="medium" @click="logload">下载</el-button>
      </el-form-item>
      <!-- <el-form-item label="" prop="">
        <el-button type="primary" @click="() => dialogTableVisible = true" plain icon="el-icon-upload2" size="medium">
          导入基值列表</el-button>
      </el-form-item> -->
    </el-form>
  </div>
</template>

<script>
// import XLSX from 'xlsx'
import { downloadequipments } from "@/api/equipmentInspct/index.js";
import { getToken } from "@/utils/auth";
export default {
  props: ['rowObj'],
  components: {
  },
  data () {
    return {
      title: '添加巡检计划',
      open: false,
      dialogTableVisible: false,
      tableData: [],
      uploadFileUrl: process.env.VUE_APP_BASE_API + "/file/upload", // 上传的图片服务器地址
      headers: {
        Authorization: "Bearer " + getToken(),
      },
      loading: false,
      btnloading: false,
      fileList: {}
    }
  },
  watch: {
    dialogTableVisible (val) {
      if (!val) {
        this.tableData = []
      }
    }
  },
  methods: {
    /**
     * 创建下载链接
     */
    logload () {
      let data = {
        id: this.rowObj.id
      };
      let filename = '巡检设备列表.xlsx';
      downloadequipments(data, filename).then()
      // dom中创建a标签
      // let aTag = document.createElement('a')
      // // 给创建的a标签添加href属性并赋值
      // aTag.href = `http://139.159.212.47:9310/statics/2022/08/29/a306372d-67c6-4bb8-afb5-d04d228f3a21.xlsx`

      // aTag.download = '设备基值列表.xlsx'
      // 自动点击创建的标签
      // aTag.click()

      // 不再使用时需释放createObjectURL创建得对象
      // URL.revokeObjectURL(blob)
    },
    /** 新增按钮操作 */
    handleAdd () {
      this.open = true
    },
    /** 修改按钮操作 */
    handleUpdate (row) {
      this.$emit('selectList')
    },
    handleDelete (index) {
      this.tableData.splice(index, 1)
    },

  }
}
</script>

<style lang="scss" scoped>
.file_div {
  overflow: hidden;
  border: 1px solid #999;
  border-radius: 10px;
}

::v-deep.dialog_import .el-scrollbar__wrap {
  overflow-x: hidden !important;
}
</style>